﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using BlogModel;

namespace BlogModel.DAL
{
    public partial class PostDB
    {
        public static List<Post> GetPostsByUserId(int userId)
        {
            var blog = DB.Context.BlogSet
                .OrderBy(b=>b.CreationDate)
                .FirstOrDefault(b => b.UserId == userId && !b.IsDeleted);
            

            return blog.Post.ToList(); 
        }

    }
}


